package com.ruoyi.lab.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;
import com.ruoyi.common.core.domain.R;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.lab.domain.JacLabStandard;
import com.ruoyi.lab.service.IJacLabStandardService;
import com.ruoyi.lab.utils.MyTool;
import java.util.Map;

/**
 * standard 提供者
 * 
 * @author ruoyi
 * @date 2021-08-25
 */
@RestController
@RequestMapping("standard")
public class JacLabStandardController extends MyTool
{
	
	@Autowired
	private IJacLabStandardService jacLabStandardService;
	
	/**
	 * 查询${tableComment}
	 */
	@GetMapping("get/{id}")
	public JacLabStandard get(@PathVariable("id") Long id)
	{
		return jacLabStandardService.selectJacLabStandardById(id);
		
	}
	
	/**
	 * 查询standard列表
	 */
	@GetMapping("list")
	public R list(JacLabStandard jacLabStandard)
	{
		startPage();
        return result(jacLabStandardService.selectJacLabStandardList(jacLabStandard));
	}
	
	
	/**
	 * 新增保存standard
	 */
	@PostMapping("save")
	public R addSave(@RequestBody JacLabStandard jacLabStandard)
	{		
		return toAjax(jacLabStandardService.insertJacLabStandard(jacLabStandard));
	}

	@PostMapping("import")
	public Map<String, String> addSave(@RequestBody MultipartFile file)  throws Exception
	{
		return jacResultMsg(jacLabStandardService.importFile(file));
	}

	/**
	 * 修改保存standard
	 */
	@PostMapping("update")
	public R editSave(@RequestBody JacLabStandard jacLabStandard)
	{		
		return toAjax(jacLabStandardService.updateJacLabStandard(jacLabStandard));
	}
	
	/**
	 * 删除${tableComment}
	 */
	@PostMapping("remove")
	public R remove(String ids)
	{		
		return toAjax(jacLabStandardService.deleteJacLabStandardByIds(ids));
	}
	
}
